import { generateMessage } from './errors.js';
export class BaseConverter {
    constructor(safeParse = false) {
        this.safeParse = safeParse;
    }
    handleExistingError(error, path, ...messages) {
        if (this.safeParse) {
            console.error(generateMessage(path, ...messages), error);
        }
        else {
            throw error;
        }
    }
    handleNewError(E, path, ...messages) {
        if (this.safeParse) {
            console.error(generateMessage(path, ...messages));
        }
        else {
            throw new E(path, ...messages);
        }
    }
}
